package com.robot.console.util;

import java.util.ArrayList;
import java.util.Random;
import com.robot.console.config.HaConfigBuilder;

public class RobotTools
{
	private static ArrayList<String> animalNameList = new ArrayList<String>();
	private static ArrayList<String> bookList = new ArrayList<String>();
	private static ArrayList<String> bookListGuest = new ArrayList<String>();
	private static ArrayList<String> bookListUsers = new ArrayList<String>();

	public static String getName(int gender)
	{
		String name = "";
		Random r = new Random();
		if (gender == HaConfigBuilder.BOY)
		{
			int index = r.nextInt(animalNameList.size());
			name = animalNameList.get(index);
		}
		else if (gender == HaConfigBuilder.GIRL)
		{
			int index = r.nextInt(animalNameList.size());
			name = animalNameList.get(index);
		}
		else
		{
			int index = r.nextInt(animalNameList.size());
			name = animalNameList.get(index);
		}
		return name;
	}

	public static int getRandomBookLine(boolean isGuest)
	{
		int randomNum = 0;
		int bookListSize = 0;

		if (isGuest == true)
		{
			bookListSize = bookListGuest.size();

		}
		else
		{
			bookListSize = bookListUsers.size();
		}

		if (bookListSize > 0)
		{
			java.util.Random r = new java.util.Random();
			randomNum = Math.abs(r.nextInt() % (bookListSize));
		}

		return randomNum;
	}

	public static String getSentence(int line)
	{
		return bookList.get(line);
	}

	public static String getSentenceFromGuestBook(int line)
	{
		return bookListGuest.get(line);
	}

	public static String getSentenceFromUserBook(int line)
	{
		return bookListUsers.get(line);
	}

	public static int getTotalBookGuestSentenceSize()
	{
		return bookListGuest.size();
	}

	public static int getTotalBookGUserSentenceSize()
	{
		return bookListUsers.size();
	}

	public static int getTotalSentenceSize()
	{
		return bookList.size();
	}
}
